package model

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Phone        string `gorm:"type:char(11);not null;commit:手机号码"`
	Email        string `gorm:"type:varchar(50);not null;commit:邮件"`
	Status       int    `gorm:"type:int;default:0;not null;commit:0-异常,1-正常"`
	MemberStatus int    `gorm:"type:int;default:0;not null;commit: 0-不是会员,1-是会员"`
}

func (u *User) GetPhoneByPhone(db *gorm.DB, phone string) error {
	err := db.Where("phone=?", phone).Limit(1).Find(&u).Error
	return err
}
func (u *User) CreateUser(db *gorm.DB) error {
	err := db.Create(&u).Error
	return err
}
